import request from '@/utils/request';

export function createArchiveClassifyAPI(cid, name) {
    return request({
        url: `/x/v1/classify/add/${cid}`,
        method: 'POST',
        data: {
            name,
        },
    });
}

export function findArchvieClassifyByTypeAPI(type) {
    return request({
        url: `/x/v1/classify/find/${type}`,
        method: 'GET',
    });
}

export function updateArchiveClassifyNameAPI(cid, name) {
    return request({
        url: `/x/v1/classify/rename/${cid}`,
        method: 'PUT',
        data: {
            name,
        },
    });
}

export function destroyArchvieClassifyAPI(cid) {
    return request({
        url: `/x/v1/classify/destory/${cid}`,
        method: 'DELETE',
    });
}

export function classifyIconUploaderAPI(cid, file) {
    const formData = new FormData();
    formData.append('file', file);
    return request({
        url: `/x/v1/classify/icon/uploader/${cid}`,
        method: 'POST',
        data: formData,
    });
}
